import { createRouter, createWebHistory } from 'vue-router'

// 用户端路由
import userRoutes from './modules/user'
// 门店端路由
import storeRoutes from './modules/store'
// 管理端路由
import adminRoutes from './modules/admin'

// 公共路由
const publicRoutes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/login/index.vue'),
    meta: { title: '登录' }
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/login/register.vue'),
    meta: { title: '注册' }
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes: [...publicRoutes, userRoutes, storeRoutes, adminRoutes]
})

export default router
